package com.csdj.music.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @ClassName: RespBean
 * @Author: ZouLi
 * @Description: 公共返回消息类
 * @Date: 2022/12/13 10:44
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespBean {
    /**
     * 状态码
     **/
    private long code;

    /**
     * 消息
     **/
    private String message;

    /**
     * 消息体
     **/
    private Object obj;

    /**
     * @Description: 返回成功信息
     * @Param [message]
     * @Return com.csdj.server.pojo.RespBean
     * @Throws
     **/
    public static RespBean success(String message){
        return new RespBean(200, message, null);
    }

    /**
     * @Description: 返回成功消息和消息体
     * @Param [message, obj]
     * @Return com.csdj.server.pojo.RespBean
     * @Throws
     **/
    public static RespBean success(String message, Object obj){
        return new RespBean(200, message, obj);
    }

    /**
     * @Description: 返回错误信息
     * @Param [message]
     * @Return com.csdj.server.pojo.RespBean
     * @Throws
     **/
    public static RespBean error(String message){
        return new RespBean(500, message, null);
    }

    /**
     * @Description: 返回错误消息和消息体
     * @Param [message, obj]
     * @Return com.csdj.server.pojo.RespBean
     * @Throws
     **/
    public static RespBean error(String message, Object obj){
        return new RespBean(500, message, obj);
    }
}
